package cn.ante.ymcc.feign;

import cn.ante.ymcc.doc.CourseDoc;
import cn.ante.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class SearchFeignClientFallbackFactory implements FallbackFactory<CouserSearchFeignClient> {

    @Override
    public CouserSearchFeignClient create(Throwable throwable) {
        return new CouserSearchFeignClient() {
            @Override
            public JSONResult saveElasticSearch(CourseDoc courseDoc) {
                throwable.printStackTrace();
                return JSONResult.error("降级了降级了");
            }

            @Override
            public JSONResult removeElasticSearch(Long id) {
                throwable.printStackTrace();
                return JSONResult.error("降级了降级了");
            }
        };
    }
}
